public class Demo4_16 {
    public static void main(String[] args) {
        String s1 = "abacdab";
        //字符的整体替换
        String ret = s1.replace('a', 'h');
        System.out.println(ret);
        //字符串的整体替换
        String ret1 = s1.replace("ab", "git");
        System.out.println(ret1);
        //替换字符串的第一个
        String ret2 = s1.replaceFirst("ab", "hhh");
        System.out.println(ret2);
        //字符串的整体替换
        String ret3 = s1.replaceAll("a","ooo");
        System.out.println(ret3);

        //字符串拆分
        String str1 = "abc&def&ghi";
        String[] strings=str1.split("&");
        for(String s: strings) {
            System.out.println(s);
        }
    }
}